//	------------------------------------------------------------------------------------------------
//	File name:		PdbSource.cpp
//	Author:			Marc Ochsenmeier
//	Email:			marc@ochsenmeier.de
//	Web:			www.breakpoints.de - 
//	Date:			02.07.2009
//
//	------------------------------------------------------------------------------------------------
#include "stdafx.h"

#include "PdbTranslationMaps.h"
#include "PdbFile.h"
#include "PdbSourceFile.h"
#include "PdbModule.h"
#include "PdbParserInternal.h"

CPdbSourceFile::CPdbSourceFile(IPdbModule* pIPdbModule, IDiaSourceFile* pIDiaSourceFile) : 
	m_pIPdbModule(pIPdbModule),
	m_pIDiaSourceFile(pIDiaSourceFile)
{
}
CPdbSourceFile::~CPdbSourceFile()
{
	if(m_pIDiaSourceFile)
	{
		m_pIDiaSourceFile->Release();
		m_pIDiaSourceFile = NULL;
	}
}
const wstring& CPdbSourceFile::GetFileName()
{
	if(m_pIDiaSourceFile)
	{
		BSTR bstrName;
		if(m_pIDiaSourceFile->get_fileName(&bstrName)==S_OK)
		{
			m_sName = bstrName;
			SysFreeString(bstrName);
		}
	}
	return m_sName;
}

const std::set<DWORD>* CPdbSourceFile::GetModuleLinesNumber()
{
	return &m_stLinesNumber;
}

int CPdbSourceFile::AddLineNumber(const DWORD dwLine)
{
	m_stLinesNumber.insert(dwLine);

	return true;
}